﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace net.entity.framework.common {
    public static class Coding {
        public static DateTime MinDateTime {
            get { return DateTime.MinValue; }
        }

        public static DateTime MaxDateTime {
            get { return DateTime.MaxValue; }
        }

        [Conditional("DoNotCallThisMethodEver")]
        public static void DoNothingWith(object obj) {}

        public static void WriteLineToBoth(string message) {
            Debug.WriteLine(message);
            Trace.WriteLine(message);
        }

        public static IEnumerable<T> MakeEnumerable<T>(params T[] items) {
            foreach (var item in items) {
                yield return item;
            }
        }

        public static string MakeCSV(IEnumerable<string> values, params string[] excluded) {
            return MakeCSV(values, string.Empty, string.Empty, excluded);
        }

        public static string MakeCSV(IEnumerable<string> values, string prefix, string postfix, params string[] excluded) {
            return String.Join(", ", values.Except(excluded).Select(x => prefix + x + postfix).ToArray());
        }
    }
}